Hi all, I did the tutorials and official django tutorial, I am also following docs but I have a problem with adding pictures via admin panel and then using it in html(imagefield).
I wanna upload a pic to /app/static/app/images via admin and then use it in html when I pass the dictionary with the modal that contains that imagefield. I managed doing that by setting this in models: class Mod(models.Model): img= models.ImageField(upload_to='app/static/app/images/', max_length=100)
and in html: {%static mod.slika|cut:'main/static/'%}
using that cut hack I do get the right link but I am pretty sure that is not the right way to do it.
You must be logged in to post. Please login or register an account.
When the image goes to that location, you can reference it like:
Not sure if you're trying to do this dynamically or what, where you may not have the image name. I'd suggest asking this in https://www.reddit.com/r/django for someone hopefully more expert in Django.
-Harrison 9 years ago
You must be logged in to post. Please login or register an account.